
#pragma once
#include "stdafx.h"

class CWicBitmapFrameDecode;

class CLASS_DECLSPEC CWicBitmapDecoder
{
    //==============================================================================
    // CWicBitmapDecoder
    //==============================================================================
public:
    CWicBitmapDecoder( 
        /* [in] */ __RPC__in LPCWSTR wzFilename,
        /* [unique][in] */ __RPC__in_opt const GUID *pguidVendor = NULL,
        /* [in] */ DWORD dwDesiredAccess = GENERIC_READ,
        /* [in] */ WICDecodeOptions metadataOptions = WICDecodeMetadataCacheOnDemand);

    CWicBitmapDecoder(
            /* [in] */ IStream *pIStream,
            /* [unique][in] */ const GUID *pguidVendor = NULL,
            /* [in] */ WICDecodeOptions metadataOptions = WICDecodeMetadataCacheOnDemand);

    CWicBitmapDecoder(CWicBitmapDecoder const &);
    virtual ~CWicBitmapDecoder(void);
    CWicBitmapDecoder& operator=(CWicBitmapDecoder const &);

    //==============================================================================
    // IWICBitmapDecoder
    //==============================================================================
public:
    virtual HRESULT QueryCapability( 
        /* [in] */ __RPC__in_opt IStream *pIStream,
        /* [out] */ __RPC__out DWORD *pdwCapability);

    virtual HRESULT Initialize( 
        /* [in] */ __RPC__in_opt IStream *pIStream,
        /* [in] */ WICDecodeOptions cacheOptions);

    virtual HRESULT GetContainerFormat( 
        /* [out] */ __RPC__out GUID *pguidContainerFormat);

    virtual HRESULT GetDecoderInfo( 
        /* [out] */ __RPC__deref_out_opt IWICBitmapDecoderInfo **ppIDecoderInfo);

    virtual HRESULT CopyPalette( 
        /* [in] */ __RPC__in_opt IWICPalette *pIPalette);

    virtual HRESULT GetMetadataQueryReader( 
        /* [out] */ __RPC__deref_out_opt IWICMetadataQueryReader **ppIMetadataQueryReader);

    virtual HRESULT GetPreview( 
        /* [out] */ __RPC__deref_out_opt IWICBitmapSource **ppIBitmapSource);

    virtual HRESULT GetColorContexts( 
        /* [in] */ UINT cCount,
        /* [size_is][unique][out][in] */ __RPC__inout_ecount_full_opt(cCount) IWICColorContext **ppIColorContexts,
        /* [out] */ __RPC__out UINT *pcActualCount);

    virtual HRESULT GetThumbnail( 
        /* [out] */ __RPC__deref_out_opt IWICBitmapSource **ppIThumbnail);

    virtual HRESULT GetFrameCount( 
        /* [out] */ __RPC__out UINT *pCount);

    virtual UINT GetFrameCount();

    virtual HRESULT GetFrame( 
        /* [in] */ UINT uIndex,
        /* [out] */ __RPC__deref_out_opt IWICBitmapFrameDecode **ppIBitmapFrame);

    virtual CWicBitmapFrameDecode* GetFrame(UINT uIndex);

private:
    IWICBitmapDecoder  *m_pIWICBitmapDecoder;
};

